//
//  MCMyPlanApi.swift
//  MCBodyBuildingPro
//
//  Created by Renlvshijie on 2023/5/30.
//

import Foundation
import Moya


enum MCMyPlanApi {
    case recommandPlan(current:Int?)
   
}

extension MCMyPlanApi:TargetType {
    
    var baseURL: URL {
        return URL.init(string: Moya_baseURL)!
    }
    
    var path: String {
        switch self {
        case .recommandPlan:
            return "api/admin/planForApp/getActionPlanPage"
        }
    }
    var method:Moya.Method {
        switch self {
        case .recommandPlan:
            return .get
       
       
        }
    }
    
    var sampleData: Data {
        return Data()
    }
    
    
    var task: Task {
        switch self {
        case let .recommandPlan(current):
            return .requestParameters(parameters: ["current":current ?? 1,"create":1,"size":20], encoding: URLEncoding.default)
        }
    }
    
    var headers: [String : String]? {
        let tokenName:String = UserDefaults.standard.string(forKey: "LoginName") ?? ""
        let tokenValue:String = UserDefaults.standard.string(forKey: "LoginToken") ?? ""
        return [tokenName:tokenValue]
    }
    
    
}
